<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    
    <script>
        function off() {
            document.getElementById('img').src = '../img/off.gif'
        }
        function on() {
            document.getElementById('img').src = '../img/on.gif'
        }
        let a = 0;
        window.setInterval(
            function () {
                if(a%2==0){
                    off()
                }else {
                    on()
                }
                a++
            },1000
        )

    </script>
</head>
<body>

<img src="../img.on.gif" id = 'img'>
</body>
</html>